/*
 * Copyright 2007 Jeffrey Palm
 */

import javax.swing.*;
import javax.swing.event.*;
import javax.swing.text.*;

class HTMLFrame extends JFrame {
  HTMLFrame(String html) {
    JEditorPane p = new JEditorPane();
    p.setContentType("text/plain");
    p.addHyperlinkListener(new HyperlinkListener() {
        public void hyperlinkUpdate(HyperlinkEvent e) {
          if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
            try {
              String url = String.valueOf(e.getURL());
              Browser.displayURL(url);
            } catch (Throwable t) {
              t.printStackTrace();
            }
          }
        }
      });
    p.setText(html);
  }
}